var moment = require('moment');  
/**
 * 系统选项
 */
module.exports = function(sequelize, DataTypes) {
    return sequelize.define("article_category", {
        id: {
            type: DataTypes.INTEGER,
            allowNull: false, //非空
            autoIncrement: true, //自动递增
            primaryKey: true //主键
        },
        categoryname: {
            type: DataTypes.STRING,
            field: "category_name",
            allowNull: false
        },
        createtime: {
            type: DataTypes.DATE,
            field: "create_time",
            defaultValue:sequelize.literal('CURRENT_TIMESTAMP'),
            get() {  
                return moment(this.getDataValue('createtime')).format('YYYY-MM-DD HH:mm:ss');  
            }  
        }
    }, {
        underscored: true, //额外字段以下划线来分割
        // createdAt: "created_at",
        // updatedAt: "updated_at",
        timestamps: false, //取消默认生成的createdAt、updatedAt字段
        freezeTableName: true, // Model 对应的表名将与model名相同
        //静态方法，即user模型自带的方法
        comment: "文章类型",
        // paranoid: true      //虚拟删除
        //实例方法
        // instanceMethods: instanceMethods
    });
}

